package algorithm.easy;

public class FindComplement476 {
    public static int findComplement(int num) {
        int i = 32 - Integer.numberOfLeadingZeros(num);
        int m = (1<<i)-1;
        return m^num;
    }

    public static void main(String[] args) {
        System.out.println(findComplement(5));
    }
}
